<template>
  <view>
    <!-- 照相机人脸页面 -->
    <view v-if="loginData">
      <!-- 人脸拍照初始化 -->
      <FacialPhotoInitContainerPage v-if="progressPhoto === 1"></FacialPhotoInitContainerPage>
      <!-- 人脸审核等待中 -->
      <FacialPhotoExaminePage v-if="progressPhoto === 2"></FacialPhotoExaminePage>
    </view>
    <!-- 没有照相机权限展示页面 -->
    <NoFacialPhotoContainer v-else></NoFacialPhotoContainer>
  </view>
</template>

<script>


import FacialPhotoInitContainerPage from "./FacialPhotoInitContainerPage.vue";
import FacialPhotoExaminePage from "./FacialPhotoExaminePage.vue";
import NoFacialPhotoContainer from "../components/faciaPhoto/NoFacialPhotoContainer.vue";

export default {
  name: 'FacialPhotoPage',
  components: {NoFacialPhotoContainer, FacialPhotoExaminePage, FacialPhotoInitContainerPage},
  computed: {
    /*socketMsgs() {
      return this.$store.getters.socketMsgs;
    }*/
  },
  watch: {
    '$store.state.isHaveCamera'(newValue, oldValue) {
      this.isHaveCamera = newValue;
    },
    '$store.state.photoProgressData.progressPhoto'(newValue, oldValue) {
      console.log("newValue",newValue)
      this.progressPhoto = newValue;
    },
    '$store.state.photoProgressData.uuid'(newValue, oldValue) {
      this.uuid = newValue;
    },
    socketMsgs(newValue, oldValue) {
      // 在这里执行你的操作
      if (newValue === 'SOCKET_FORCE_SUBMIT') {
        //this.handlesubmitPaper();
      }
    }
  },
  data() {
    return {
      // 是否有照相机
      isHaveCamera: true,
      // 人脸步骤
      progressPhoto: 1,
      // 申请求助的返回uuid
      uuid: "",  //暂时没有使用
      // 是否是补考水印
      source: '',
      loginData: null
    };
  },
  created() {
    this.source = this.$store.state.photoProgressData.source;

    console.log(this.$store.state)
  },
  onLoad(options) {
    this.upgPracticeUuid = options.upgPracticeUuid
  },
  onShow() {
    if (uni.getStorageSync('appKey')) {
      console.log(uni.getStorageSync('loginData'))
      this.loginData = {
        ...uni.getStorageSync('loginData'),
      };
    }
  },
}
</script>

<style lang="scss">
.watermark {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
}
</style>